package client.data;

import java.io.Serializable;
import java.security.KeyPair;
import java.security.PrivateKey;

import packets.client.PublicKeyPair;

/**
 * Class that stores 2 {@link KeyPair}s, one for encrypting/decrypting a message , and one for signing/verifying a message
 */
public class KeyPairPair implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private KeyPair _msgKey;
	private KeyPair _sigKey;
	
	/**
	 * Creates an instance of {@link PublicKeyPair}
	 * @param msgKey encryption/decryption key
	 * @param sigKey digital signature signing/verifying key
	 */
	public KeyPairPair(KeyPair msgKey, KeyPair sigKey) {
		_msgKey = msgKey;
		_sigKey = sigKey;
	}
	
	/**
	 * retrieve the public keys from this instance
	 * @return the 2 public keys from this instance
	 */
	public PublicKeyPair getPublicKeys(){
		return new PublicKeyPair(_msgKey.getPublic(), _sigKey.getPublic());
	}
	/**
	 * retrieve the key to decrypt a message that was encrypted with the public encryption key 
	 * @return the decryption key from this instance
	 */
	public PrivateKey getDecryptionKey(){
		return _msgKey.getPrivate();
	}
	/**
	 * retrieve the key to sign a message which can be verified using the signing key
	 * @return the signing key from this instance
	 */
	public PrivateKey getSigningKey(){
		return _sigKey.getPrivate();
	}
}
